//
//  NSDictionary+Mac.m
//  ArtCircle
//
//  Created by sunbin on 2017/5/18.
//  Copyright © 2017年 Quanli. All rights reserved.
//

#import "NSDictionary+Mac.h"

@implementation NSDictionary (Mac)
- (NSString*)dictionaryToJson {

    NSError *parseError = nil;
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:self options:NSJSONWritingPrettyPrinted error:&parseError];
    return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];


}

- (BOOL)server_Getcodecheck {

    NSString *success = IF_NULL_TO_STRING([self objectForKey:@"success"]);
    NSString *code    = IF_NULL_TO_STRING([self objectForKey:@"code"]);
    
    
    return [success isEqualToString:@"1"]&&[code isEqualToString:@"200"]?YES:NO;

}


- (NSMutableDictionary *)pickID {

    NSMutableDictionary *dic = [self mutableCopy];
  
    NSString *value =  IF_NULL_TO_STRING([dic objectForKey:@"id"]);
    
    [dic removeObjectForKey:@"id"];
    
    [dic setObject:value forKey:@"getnewid"];
    
    return dic;

}






@end
